package 简单;

public class 汉明距离 {


    public static int hammingDistance(int x, int y) {
        int i = x ^ y;
        int res = 0;
        while (i > 0){
            i &= i - 1;
            res++;
        }
        return res;
    }


    public static void main(String[] args) {
        System.out.println(hammingDistance(1, 4));
    }
}
